feat: support custom additional information in PR welcome message#1147
feat: support custom additional information in PR welcome message#1147rnetser wants to merge 10 commits into
Conversation
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Container Operations
Cherry-pick Operations
Branch Management
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
AI Features
Security Checks
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
PR Summary by QodoSupport custom “Additional Information” section in PR welcome messages
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
13 rules 1.
|
|
@qodo-code-review[bot] The following review comments were reviewed and a decision was made:
|
Thanks — this looks consistent with the intended fix set.
If the published summary still shows an active item, it’s likely just stale metadata and should clear once the review state refreshes. |
|
@qodo-code-review Please re-evaluate all remaining sticky findings against the current code. |
I re-checked the only remaining active sticky finding, Result
Conclusion
|
|
@qodo-code-review Please re-evaluate all remaining sticky findings against the current code. |
I re-checked the remaining sticky finding against the current code.
No active sticky findings remain. |
|
Code review by qodo was updated up to the latest commit 31ddf36 |
|
@qodo-code-review[bot] The following review comments were reviewed and a decision was made:
|
Thanks — both items look addressed.
If you want, I can also take another pass over the remaining implemented/dismissed findings for consistency. |
|
Code review by qodo was updated up to the latest commit 520526d |
|
@qodo-code-review[bot] The following review comments were reviewed and a decision was made:
|
Thanks — that matches the change in
|
Signed-off-by: rnetser <rnetser@redhat.com> Co-authored-by: PI (claude-opus-4-6) <noreply@pi.dev> Signed-off-by: rnetser <rnetser@redhat.com>
Signed-off-by: rnetser <rnetser@redhat.com> Co-authored-by: PI (claude-opus-4-6) <noreply@pi.dev> Signed-off-by: rnetser <rnetser@redhat.com>
- Revert manual docs/ edits (regenerate with docsfy) - Add load_welcome_extra_info_from_file() call in /reprocess path - Rename _load_welcome_extra_info_from_file to public method - Extract 10240 and filename string to module constants - DRY mock_to_thread into autouse class fixture - Use constant in log message and fix Generator type hint Signed-off-by: rnetser <rnetser@redhat.com> Assisted-by: Claude <noreply@anthropic.com> Co-authored-by: PI (claude-opus-4-6) <noreply@pi.dev> Signed-off-by: rnetser <rnetser@redhat.com>
- Add .github-webhook-server-welcome-message.md to stable interfaces list in AGENTS.md - Extract _create_mock_github_webhook() and _create_mock_owners_file_handler() as module-level helpers in test_pull_request_handler.py to eliminate ~55 lines of duplication - Add docstrings to all test methods in TestPrepareExtraInfoWelcomeSection and TestLoadWelcomeExtraInfoFromFile Signed-off-by: Ruth Netser <rnetser@redhat.com> Assisted-by: Claude Co-authored-by: PI (claude-opus-4-6) <noreply@pi.dev> Signed-off-by: rnetser <rnetser@redhat.com>
Move load_welcome_extra_info_from_file() inside the welcome comment existence check to avoid unnecessary GitHub API call during /reprocess when welcome comment already exists. Signed-off-by: Ruth Netser <rnetser@redhat.com> Assisted-by: Claude Co-authored-by: PI (claude-opus-4-6) <noreply@pi.dev> Signed-off-by: rnetser <rnetser@redhat.com>
ac63194 to
5513e10
Compare
|
Clean rebase detected — no code changes compared to previous head ( |
|
Code review by qodo was updated up to the latest commit 5513e10 |
Move welcome-extra-info definition to $defs section and use $ref at both global and per-repo levels, matching the pattern used by ai-features and security-checks. Single source of truth for type/maxLength. Signed-off-by: Ruth Netser <rnetser@redhat.com> Assisted-by: Claude Signed-off-by: rnetser <rnetser@redhat.com>
|
Code review by qodo was updated up to the latest commit 2c99e78 |
|
/verified |
Remove 'reopened' from the action list that triggers load_welcome_extra_info_from_file() in process(). The reopened handler does not build a welcome comment, so the file fetch was an unnecessary API call. Signed-off-by: Ruth Netser <rnetser@redhat.com> Assisted-by: Claude Signed-off-by: rnetser <rnetser@redhat.com>
| if self.github_event == "pull_request" and self.hook_data.get("action") in ( | ||
| "opened", | ||
| "ready_for_review", | ||
| ): | ||
| await self.load_welcome_extra_info_from_file() | ||
|
|
There was a problem hiding this comment.
1. Duplicate file fetch 🐞 Bug ➹ Performance
GithubWebhook.process() preloads .github-webhook-server-welcome-message.md on pull_request opened/ready_for_review, but PullRequestHandler.process_new_or_reprocess_pull_request() loads the same file again when creating the welcome comment. This causes an avoidable second get_contents() call on the common path where a welcome comment is created (including draft→ready_for_review).
Agent Prompt
### Issue description
The welcome-extra-info markdown file is fetched twice during welcome-comment creation for `pull_request` `opened` / `ready_for_review` events: once in `GithubWebhook.process()` and again in `PullRequestHandler.process_new_or_reprocess_pull_request()`.
### Issue Context
The handler already loads the file only when it is about to build a welcome message (and only when a welcome comment doesn’t exist). The earlier preload in `GithubWebhook.process()` is therefore redundant for these paths and costs an extra GitHub API call.
### Fix Focus Areas
- webhook_server/libs/github_api.py[696-701]
- webhook_server/libs/handlers/pull_request_handler.py[1975-1980]
### Implementation guidance
Choose one of:
1) Remove the preload from `GithubWebhook.process()` and rely on the handler(s) to call `load_welcome_extra_info_from_file()` only when building/regenerating the welcome message.
2) Add a small memoization flag on `GithubWebhook` (e.g., `welcome_extra_info_file_checked: bool`) so subsequent calls within the same webhook instance become no-ops.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Code review by qodo was updated up to the latest commit 634d8f8 |
Summary
Add
welcome-extra-infoconfig option and.github-webhook-server-welcome-message.mdfile-based override to inject custom markdown content into PR welcome messages.Changes
webhook_server/config/schema.yaml):welcome-extra-info(string, maxLength 10240) at global + per-repo levelwebhook_server/libs/github_api.py): Load from config viaget_value(), async file loading from.github-webhook-server-welcome-message.md(10KB limit, UTF-8 validation), guarded by PR opened/reopened/ready_for_review and issue_comment eventswebhook_server/libs/handlers/pull_request_handler.py):_prepare_extra_info_welcome_sectionproperty renders### 📋 Additional Informationsection after Tipsexamples/config.yaml): Commented examplesPriority Chain (first match wins)
.github-webhook-server-welcome-message.mdfile in repo.github-webhook-server.yamlwelcome-extra-infoconfig.yamlper-repowelcome-extra-infoconfig.yamlglobalwelcome-extra-infoEmpty file or empty string explicitly suppresses inherited values.
E2E Test Results
Closes #1143